﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ProgramMain.Framework;

namespace ProgramMain.Classifiers
{
    public partial class ColorList : ProgramMain.Framework.BaseGridListCtl
    {
        public ColorList()
        {
            InitializeComponent();
        }

        protected override void LoadData()
        {
            //прочитать данные из базы и заполнить датасет
            this.colorsTableAdapter.SelectCommandTimeout = ProgramMain.Properties.Settings.Default.LongQueryTimeout;
            this.colorsTableAdapter.Fill(this.simpleOpticNetDB.Colors);
            UpdateStatusText(this.simpleOpticNetDB.OwnerCompanies);
        }

        protected override void UpdateData()
        {
            //внести изменения в базу
            this.colorsTableAdapter.SetUpdateTimeout = ProgramMain.Properties.Settings.Default.LongQueryTimeout;
            this.colorsTableAdapter.Update(this.simpleOpticNetDB.Colors);
            UpdateStatusText(this.simpleOpticNetDB.OwnerCompanies);
        }

        override protected BaseModalDetailCtl CreateDetailDialog(BaseModalDetailCtl.ShowModeTypes pShowMode)
        {
            return new ColorDetail();
        }

        public override BaseSecurity.SuperBool CheckSecurityAction(BaseSecurity.SecurityActionType ActionType, bool ShowWarning)
        {
            if (BaseSecurity.CheckSecuritySuperAction())
            {
                return BaseSecurity.SuperBool.True;
            }

            return BaseSecurity.SuperBool.False;
        }
    }
}
